<template>
  <view class="navigation">
    <view class="left">
      <view class="item">
        <view class="show"  @click="indexHandle">
          <u-icon name="home" :size="40" :color="$u.color['contentColor']"></u-icon>
          <view class="text u-line-1">首页</view>
        </view>

      </view>

      <view class="item">
        <view class="show">
          <u-icon name="server-fill" :size="40" :color="$u.color['contentColor']"></u-icon>
          <view class="text u-line-1">客服</view>
          <contact-button class="contact-button" tnt-inst-id="8Qi_PL6Y" scene="SCE01205739" size="14" :icon="imageUrl + 'kefu.png'" />

        </view>
      </view>


    </view>
    <view class="right">
      <view class="buy btn u-line-1" @click="buyHandle">立即免押</view>
    </view>
  </view>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed:{
    ...mapState(['imageUrl'])
  },
  methods: {

    /* 立即购买 */
    buyHandle() {
      this.$emit("buy");
    },

    // 回首页
    indexHandle(){
      uni.redirectTo({
          url: '/pages/index/index'
      });
    },


  },
};
</script>

<style lang="scss">
.navigation {
  display: flex;
  justify-content: space-between;
  border: solid 2rpx #f2f2f2;
  background-color: #ffffff;
  padding: 16rpx 0;

  .left {
    display: flex;
    font-size: 20rpx;

    .item {
      position: relative;
      margin: 0 30rpx;

      &.car {
        text-align: center;
        position: relative;

        .car-num {
          position: absolute;
          top: -10rpx;
          right: -10rpx;
        }
      }

      .show {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        contact-button{
          position: absolute;
          z-index: 100;
          top: 0;
          right: 0;
          bottom: 0;
          left: 0;
          opacity: 0;
        }
      }

      .Ability {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0%;
        left: 0;
        opacity: 0;
      }
    }
  }

  .right {
    display: flex;
    font-size: 28rpx;
    align-items: center;
    margin-right: 10px;

    .btn {
      line-height: 66rpx;
      padding: 0 30rpx;
      border-radius: 36rpx;
      color: #ffffff;
    }

    .cart {
      background-color: #ed3f14;
      margin-right: 30rpx;
    }

    .buy {
      background-color: #ff7d55;
      background-image: linear-gradient(to right, #ff7d55, #ff4b4d);
    }
  }
}
</style>
